package com.ellricky.baselib.util

import android.app.Activity
import android.content.Intent
import androidx.fragment.app.Fragment

inline fun <reified T> Activity.jump(
    requestCode: Int = 0,
    noinline block: Intent.() -> Unit = {},
) {
    val intent = Intent(this, T::class.java)
    intent.block()
    startActivityForResult(intent, requestCode)
}

inline fun <reified T> Fragment.jump(
    requestCode: Int = 0,
    noinline block: Intent.() -> Unit = {},
) {
    val intent = Intent(requireContext(), T::class.java)
    intent.block()
    startActivityForResult(intent, requestCode)
}
